/**
 * 
 */
package net.sowow.ws.areacalculation;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
 * The Class AreaCalculationImpl.
 *
 * @author allen
 */
public class AreaCalculationImpl implements AreaCalculationInterface {

	/**
	 * Rectangle area.
	 *
	 * @param h the h
	 * @param b the b
	 * @return the float
	 * @see net.sowow.ws.areacalculation.AreaCalculationInterface#rectangleArea(float, float)
	 */
	@Override
	@WebMethod(action = "http://ws.sowow.net/AreaCalculation/rectangleArea")
	@WebResult(name = "area", targetNamespace = "")
	@RequestWrapper(localName = "rectangleArea", targetNamespace = "http://ws.sowow.net/AreaCalculation/", className = "net.sowow.ws.areacalculation.RectangleArea")
	@ResponseWrapper(localName = "rectangleAreaResponse", targetNamespace = "http://ws.sowow.net/AreaCalculation/", className = "net.sowow.ws.areacalculation.RectangleAreaResponse")
	public float rectangleArea(
			@WebParam(name = "h", targetNamespace = "") float h,
			@WebParam(name = "b", targetNamespace = "") float b) {
		// TODO Auto-generated method stub
		return 0;
	}

	/**
	 * Circle area.
	 *
	 * @param r the r
	 * @return the float
	 * @see net.sowow.ws.areacalculation.AreaCalculationInterface#circleArea(float)
	 */
	@Override
	@WebMethod(action = "http://ws.sowow.net/AreaCalculation/circleArea")
	@WebResult(name = "area", targetNamespace = "")
	@RequestWrapper(localName = "circleArea", targetNamespace = "http://ws.sowow.net/AreaCalculation/", className = "net.sowow.ws.areacalculation.CircleArea")
	@ResponseWrapper(localName = "circleAreaResponse", targetNamespace = "http://ws.sowow.net/AreaCalculation/", className = "net.sowow.ws.areacalculation.CircleAreaResponse")
	public float circleArea(@WebParam(name = "r", targetNamespace = "") float r) {
		float area = (float)Math.PI*r*r;
		return area;
	}

	/**
	 * Triangle area.
	 *
	 * @param h the h
	 * @param a the a
	 * @return the float
	 * @see net.sowow.ws.areacalculation.AreaCalculationInterface#triangleArea(float, float)
	 */
	@Override
	@WebMethod(action = "http://ws.sowow.net/AreaCalculation/triangleArea")
	@WebResult(name = "area", targetNamespace = "")
	@RequestWrapper(localName = "triangleArea", targetNamespace = "http://ws.sowow.net/AreaCalculation/", className = "net.sowow.ws.areacalculation.TriangleArea")
	@ResponseWrapper(localName = "triangleAreaResponse", targetNamespace = "http://ws.sowow.net/AreaCalculation/", className = "net.sowow.ws.areacalculation.TriangleAreaResponse")
	public float triangleArea(
			@WebParam(name = "h", targetNamespace = "") float h,
			@WebParam(name = "a", targetNamespace = "") float a) {
		float area = 1/2*a*h;
		return area;
	}

	
	/**
	 * Ellipse area.
	 *
	 * @param a the a
	 * @param b the b
	 * @return the float
	 * @see net.sowow.ws.areacalculation.AreaCalculationInterface#ellipseArea(float, float)
	 */
	@Override
	@WebMethod(action = "http://ws.sowow.net/AreaCalculation/ellipseArea")
	@WebResult(name = "area", targetNamespace = "")
	@RequestWrapper(localName = "ellipseArea", targetNamespace = "http://ws.sowow.net/AreaCalculation/", className = "net.sowow.ws.areacalculation.EllipseArea")
	@ResponseWrapper(localName = "ellipseAreaResponse", targetNamespace = "http://ws.sowow.net/AreaCalculation/", className = "net.sowow.ws.areacalculation.EllipseAreaResponse")
	public float ellipseArea(
			@WebParam(name = "a", targetNamespace = "") float a,
			@WebParam(name = "b", targetNamespace = "") float b) {
		float area = (float) Math.PI * a * b;
		return area;
	}

}
